/*
 * Copyright (c) 2020-2030 Sishun.Co.Ltd. All Rights Reserved.
 */
package com.rabbitmq.demo.workmodle;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author ：lvfeilong
 * @version ：
 * @description ：
 * @program ：MySpringBoot
 * @date ：Created in 2021/4/8 10:05
 */
@Slf4j
@Component
public class TopicModle {

    @RabbitListener(bindings = {@QueueBinding(value = @Queue, exchange = @Exchange(name = "topic", type = "topic"), key = {"zhangsan.#"})})
    public void customer1(String message) {
        log.error("topic消费者1：{}",message);
    }

    @RabbitListener(bindings = {@QueueBinding(value = @Queue, exchange = @Exchange(name = "topic", type = "topic"), key = {"zhangsan.*"})})
    public void customer2(String message) {
        log.error("topic消费者2：{}",message);
    }

    @RabbitListener(bindings = {@QueueBinding(value = @Queue, exchange = @Exchange(name = "topic", type = "topic"), key = {"zhangsan"})})
    public void customer3(String message) {
        log.error("topic消费者3：{}",message);
    }
}